uniform float Rate;
uniform float Amplitude;
uniform float alphamultiplier;

varying float alpha;

void main()
{
  float angle = gl_Vertex[2];
  float rate = Rate * gl_Normal[0];
  vec4 newPos;
  alpha = alphamultiplier * 0.1;
  
    newPos[0] = gl_Vertex[0] - Amplitude * 3.0*gl_Normal[0]* cos(abs(gl_Normal[0])*2.0*(rate + 3.0*angle)) * abs(-1+abs(angle-5)/5);// - sin(rate + angle);
    newPos[1] = gl_Vertex[1] + Amplitude * 3.0*gl_Normal[0]* sin(abs(gl_Normal[0])*2.0*(rate + 3.0*angle)) * abs(-1+abs(angle-5)/5);

  newPos[2] = gl_Vertex[2];
  newPos[3] = gl_Vertex[3];
  
  gl_FrontColor = gl_Color;
  //if(gl_Normal[1] == 1)
   // gl_FrontColor = vec4(0.3,0.3,1.0,1);//gl_Color;
  //else
   // gl_FrontColor = vec4(0.75,0.75,0.3,1);//gl_Color;

  gl_Position = gl_ModelViewProjectionMatrix * newPos;
}
